import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import CategoryDetail from '../views/CategoryDetail.vue'
import Courses from '../views/Courses.vue'
import Cart from '../views/Cart.vue'
import About from '../views/About.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/category/:id',
    name: 'CategoryDetail',
    component: CategoryDetail,
    props: true
  },
  {
    path: '/courses',
    name: 'Courses',
    component: Courses
  },
  {
    path: '/cart',
    name: 'Cart',
    component: Cart
  },
    {
    path: '/about',
    name: 'About',
    component: About
  },
  {
    path: '/product/:id',
    name: 'ProductDetail',
    component: () => import('../views/ProductDetail.vue'),
    props: true
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router